#pragma once

#include "Misc/EngineEditorMacros.h"
#include "Object/Object.h"
#include "EditorPageAreaViewModel.h"
#include "EditorPageAreaView.m.h"

class RWidget;
class REditorPageView;

RCLASS()
class REditorPageAreaView : public RObject
{
    ROBJECT

public:
    void BindViewModel(TSharedObjectPtr<REditorPageAreaViewModel> InViewModel);
    void CreateWidget(TSharedObjectPtr<RWidget> InParent);

protected:
    TWeakObjectPtr<REditorPageAreaViewModel> ViewModel;

    TVector<TSharedObjectPtr<REditorPageView>> Pages;

    TWeakObjectPtr<RWidget> RootWidget;
    TWeakObjectPtr<RWidget> PageTitleBar;
    TWeakObjectPtr<RWidget> PageOperationsParent;
    TWeakObjectPtr<RWidget> PageContent;

    void CreateWidgetInRoot();
    
    void CreatePages();
    void CreatePageTitle(int64_t Index);
    void CreatePageOperation(int64_t Index);
    void CreatePageWidget(int64_t Index);

    //创建查找替换控件
    void CreateFindAndReplaceWidget();

    // void CreateSubAreas();
    // TVector<TSharedObjectPtr<REditorPageAreaView>> SubAreaViews;

    void ShowPageTitleContextMenu(int64_t Index);
    
};